﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XNAchievement.Achievements;

namespace XNAchievement
{
    /// <summary>
    /// The types of notifications achivements can produce.
    /// </summary>
    public enum NotificationType
    {
        /// <summary>
        /// The achievement was unlocked.
        /// </summary>
        Unlocked,
        /// <summary>
        /// The achievement progressed (e.g. a counter was increased).
        /// </summary>
        Progressed,
        /// <summary>
        /// A special event happened.
        /// </summary>
        Special
    }

    /// <summary>
    /// EventArgs for the Notification Event.
    /// </summary>
    public class NotificationEventArgs : EventArgs
    {
        /// <summary>
        /// The type of the notification.
        /// </summary>
        public NotificationType NotificationType { get; protected set; }

        /// <summary>
        /// Additional information about the event. (In case of "Progressed" this
        /// is a float with the current progress.
        /// </summary>
        public object UserData { get; protected set; }

        public NotificationEventArgs(NotificationType type, object data)
        {
            NotificationType = type;
            UserData = data;
        }
    }

    /// <summary>
    /// EventArgs for the AnyNotification event.
    /// </summary>
    public class AnyNotificationEventArgs : NotificationEventArgs
    {
        public Achievement Achievement { get; protected set; }

        public AnyNotificationEventArgs(Achievement achievement, NotificationType type, object data)
            : base(type, data)
        {
            Achievement = achievement;
        }

        public AnyNotificationEventArgs(Achievement achievement, NotificationEventArgs e)
            :base(e.NotificationType, e.UserData)
        {
            Achievement = achievement;
            NotificationType = e.NotificationType;
            UserData = e.UserData;
        }
    }

    /// <summary>
    /// EventArgs for the Progressing Event.
    /// </summary>
    public class ProgressingEventArgs : EventArgs
    {
        /// <summary>
        /// The current completion percentage.
        /// </summary>
        public float Amount { get; protected set; }

        /// <summary>
        /// Set this to true to cancel the notification.
        /// </summary>
        public bool Cancel { get; set; }

        public ProgressingEventArgs(float amount)
        {
            Amount = amount;
            Cancel = false;
        }
    }

    /// <summary>
    /// EventArgs for the AnyUnlocked event.
    /// </summary>
    public class AnyUnlockedEventArgs : EventArgs
    {
        public Achievement Achievement { get; private set; }

        public AnyUnlockedEventArgs(Achievement achievement)
        {
            Achievement = achievement;
        }
    }
}
